/**
  */

package org.rescue.Dag;

public class Concept
{
	public String label;
	public int id;
	public int card; // number of docs not covered by any descendent of this node
	public int dCard;
	
	private Object auxData;
	
	public Concept()
    {
		card = 0;
		dCard = 0;
    }
	
    public Concept( int id)
    {
        this.id = id;
        this.card        = 0;
        this.dCard     = 0;
    }
	

    /**
     * Create new concept from full set of its objects.
     *
     * @param displayValue string that represents the category
     * @param value category object itself
     * @param property category property (missing, valid, positive, ...)
     * @see CategoryProperty
     */
    public Concept( int id, int card, int dCard)
    {
        this.id = id;
        this.card        = card;
        this.dCard     = dCard;
    }

	public Object getAuxData() {
		return auxData;
	}

	public void setAuxData(Object otherData) {
		this.auxData = otherData;
	}
    
    // -----------------------------------------------------------------------
    //  java.lang.Object methods
    // -----------------------------------------------------------------------
    /**
     * Return hash code using only the hash code of the
     * category object (value).
     *
     * @return hash code of value
     */
    public int hashCode()
    {
        int hash = (new Integer(id)).hashCode();
        return hash;
    }

    /**
     * Check for equality based only on the equality
     * operation of the category objects (values).
     *
     * @param obj object to compare
     * @return equality based on values comparison
     */
    public boolean equals( Object obj )
    {
        boolean b = false;
        if( obj != null && ( obj instanceof Concept ) )
        {
            Concept concept = (Concept)obj;
            b = (id == concept.id );
            // b = label.equals( concept.label );
        }
        return b;
    }

    /**
     * Return display value as string representation.
     *
     * @return display value
     */
    public String toString()
    {
        return label + " " + id + " " + card + " " + dCard;
    }
}
